package week11;

public class Main0_2 {
	public static void main(String[] args) {
		Thread t1 = new Thread(new TaskAdd());
		Thread t2 = new Thread(new TaskAdd());
		Thread t3 = new Thread(new TaskAdd());
		t1.start();
		t2.start();
		t3.start();
		try {
			t1.join();
			t2.join();
			t3.join();
		}catch(InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println(TaskAdd.x);
	}
}

class TaskAdd implements Runnable
{
	public static int x = 0;
	@Override
	public void run() {
		for (int i = 0; i < 10; i++) {
			x++;
			Thread.yield();
		}
	}
	
}